import React, { Component } from 'react'
// 点击 +1
// #1 绑定点击事件
// #2 获取原来的数字
// #3 在原来的数字的基础上 +1

export default class App extends Component {
  state = {
    count: 0,
  }
  handleClick() {
    console.log(this.state.count)
  }
  render() {
    return (
      <div style={{ textAlign: 'center' }}>
        <h2>计数器：{this.state.count}</h2>
        {/* <button
          onClick={() => {
            console.log('~~~')
            // this => 实例
            this.handleClick()
          }}
        >
          +1
        </button> */}
        <button onClick={() => this.handleClick()}>+1</button>
      </div>
    )
  }
}
